﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Threading;

namespace C7
{
	/// <summary>
	/// Interaction logic for BaseWindow.xaml
	/// </summary>
    public partial class LyricsWindow : UserControl
    {
        private WindowOperations WindowOPs = new WindowOperations();
        public LyricsWindow()
        {
            this.InitializeComponent();
            WindowOPs.WindowToAnimationHandlers(LayoutRoot, true);
            Lyrics = Info.CurrentSong.Lyrics;
            tbArtistSong.Text = Info.CurrentSong.Artist + " - " + Info.CurrentSong.Name;
        }


        #region LyricsProperty
        public string Lyrics
        {
            get { return (string)GetValue(LyricsProperty); }
            set { SetValue(LyricsProperty, value); }
        }

        public static readonly DependencyProperty LyricsProperty =
                                                DependencyProperty.Register(
                                                                            "Lyrics",
                                                                            typeof(string),
                                                                            typeof(LyricsWindow),
                                                                            new FrameworkPropertyMetadata(
                                                                            new PropertyChangedCallback(ChangeLyrics)));

        private static void ChangeLyrics(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            (source as LyricsWindow).UpdateLyrics((e.NewValue as string));
        }

        private void UpdateLyrics(string newLyrics)
        {
            tbLyrics.Text = newLyrics;
        }
        #endregion
    }
}